package com.oceansoft.core.dao.util;



import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;


public class SqlParameterSourceWithoutNull extends
		BeanPropertySqlParameterSource {

	public SqlParameterSourceWithoutNull(Object object) {
		super(object);
	}

	public boolean hasValue(String paramName) {
		boolean hasValueFlag = super.hasValue(paramName);
		if (hasValueFlag) {
			Object value = super.getValue(paramName);
			if (value != null) {
				Class<?> v_Type = value.getClass();
				if (CheckValueUtil.isNotNullValue(value, v_Type)) {
					hasValueFlag = true;
				} else {
					hasValueFlag = false;
				}
			} else {
				hasValueFlag = false;
			}
		}
		return hasValueFlag;
	}

	public Object getValue(String paramName) throws IllegalArgumentException {
		Object value = super.getValue(paramName);
		if (value != null) {
			Class<?> v_Type = value.getClass();
			if (!CheckValueUtil.isNotNullValue(value, v_Type)) {
				value = null;
			}
		}
		return value;
	}
}
